Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add password visibility toggle and strength checker to teacher invitation registration form #2372

Merged
merged 6 commits into from
Oct 25, 2024

Conversation

besque
Copy link
Contributor

@besque besque commented Oct 25, 2024

This pr fixes issue #2304

Description

Fixed missing JavaScript functionality in teacher invitation registration form. Added prefix to match main registration form's field IDs, which restored:

  • Password reveal icon functionality
  • Password strength checker
  • Matches behavior of main registration form

Root cause:

  • The invited teacher form was using different field IDs than the main registration form
  • Added prefix = 'teacher_signup' to InvitedTeacherForm class to match the main registration form's ID pattern
  • This ensures the JavaScript can properly bind to the password input fields

Bug

When teachers were invited to join a school, the password registration form was missing the reveal password icon and strength checker that exists in the main registration form.
image

Fixed

image

How Has This Been Tested?

  1. Logged in as a school admin
  2. Invited a teacher to join the school using an unused email address
  3. Followed the registration link
  4. Verified that:
    • Password reveal (eye) icon appears and functions correctly
    • Password strength checker shows and updates while typing
    • Behavior matches the main registration form exactly
    • Both password and confirm password fields work as expected

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have linked this PR to a ZenHub Issue.

This change is Reviewable

@besque besque changed the title Fixed teacher invitation registration form password visibility and strength checker fix: Add password visibility toggle and strength checker to teacher invitation registration form Oct 25, 2024
Copy link
Contributor

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @besque)


portal/templates/portal/teach/invited.html line 23 at r1 (raw file):

            </div>

            <form class="d-flex flex-column" method="post" id="teacher-register-form" autocomplete="off">

I'm not 100% sure how this might have broken the test (maybe it's the prefix instead) but have a look at this test: https://github.com/ocadotechnology/codeforlife-portal/blob/master/portal/tests/test_invite_teacher.py#L26

It fails on line 74 meaning that the success message isn't showing. If you look at lines 63-68, the test inputs the test password in the teacher_password and teacher_confirm_password fields and my bet is that the names of these fields have changed, causing the form not to submit successfully in the test.

Let me know if that's correct

@besque
Copy link
Contributor Author

besque commented Oct 25, 2024

Ah, I suppose the tests are failing because of the prefix, the test would be expecting the field name without the prefix.
I've modified the InvitedTeacherForm in teach.py to keep the original field names while still getting the ID's we want.

Hope this fixes it, really sorry 😅

Please check and let me know, Thank you!

@faucomte97
Copy link
Contributor

faucomte97 commented Oct 25, 2024

@besque It looks like you're getting a different error now - seems like name isn't an attribute of the fields

@besque
Copy link
Contributor Author

besque commented Oct 25, 2024

My apologies, I'm looking into this

@faucomte97
Copy link
Contributor

No worries! The test logs should hopefully have clear error messages but if you have any questions feel free to ask 😄

@besque
Copy link
Contributor Author

besque commented Oct 25, 2024

Ahh, I was trying to acess the field's name from the field object, I've updated the code to acess the field name directly from the dictionary key instead.

This should do the job

@faucomte97
Copy link
Contributor

faucomte97 commented Oct 25, 2024

Hi @besque, I might be wrong but I think you just need to update the failing test so that the correct ID is used - similarly to how this test uses the full ID with the prefix too

@besque
Copy link
Contributor Author

besque commented Oct 25, 2024

hey @faucomte97,

You're right, I've updated it so that even the prefix is included so it shouldn't give that error anymore.

Sorry for the delay 😅

Copy link
Contributor

@faucomte97 faucomte97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @besque)

@faucomte97 faucomte97 merged commit e3b10ab into ocadotechnology:master Oct 25, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Teacher registration form missing JavaScript elements when invited to school
2 participants